home
***
CD-ROM
|
disk
|
FTP
|
other
***
search
/
Columbia Kermit
/
kermit.zip
/
newsgroups
/
misc.19980901-19981211
/
000241_news@newsmaster….columbia.edu _Thu Oct 29 19:24:48 1998.msg
< prev
next >
Wrap
Internet Message Format
|
2020-01-01
|
4KB
Return-Path: <news@newsmaster.cc.columbia.edu>
Received: from newsmaster.cc.columbia.edu (newsmaster.cc.columbia.edu [128.59.35.30])
by watsun.cc.columbia.edu (8.8.5/8.8.5) with ESMTP id TAA02104
for <kermit.misc@watsun.cc.columbia.edu>; Thu, 29 Oct 1998 19:24:48 -0500 (EST)
Received: (from news@localhost)
by newsmaster.cc.columbia.edu (8.8.5/8.8.5) id TAA06910
for kermit.misc@watsun; Thu, 29 Oct 1998 19:24:47 -0500 (EST)
Path: news.columbia.edu!panix!howland.erols.net!Supernews73!supernews.com!Supernews69!not-for-mail
From: "Michael Rose" <mike@tegris.com>
Newsgroups: comp.protocols.kermit.misc
Subject: Re: sending variables on the command line
Date: Thu, 29 Oct 1998 16:21:17 -0800
Organization: http://www.supernews.com, The World's Usenet: Discussions Start Here
Lines: 102
Message-ID: <71b0p0$idm$1@supernews.com>
References: <71810c$31v$1@supernews.com> <718456$a8l$1@apakabar.cc.columbia.edu>
NNTP-Posting-Host: 207.153.137.197
X-Trace: 909706848 C4TGOY8WA89C5CF99C usenet53.supernews.com
X-Complaints-To: newsabuse@supernews.com
X-Newsreader: Microsoft Outlook Express 4.72.3110.5
X-MimeOLE: Produced By Microsoft MimeOLE V4.72.3110.3
Xref: news.columbia.edu comp.protocols.kermit.misc:9441
Thanks! Your information helped solve a number of problems I've had with
scripting.
Regards,
Michael Rose
Frank da Cruz wrote in message <718456$a8l$1@apakabar.cc.columbia.edu>...
>In article <71810c$31v$1@supernews.com>, Michael Rose <mike@tegris.com>
wrote:
>: I have a script that I would like to send variables from the command
prompt.
>:
>: kermit script-name variable1 variable2 variable3 variable4
>:
>Let's assume you are talking about C-Kermit 6.0.
>
>: $kermit maillogs 10.2.2.14 joebloe joepasswd maillog
>:
>This can't work because "10.2.2.14", "joebloe", "joepasswd", and "maillog"
>are not valid C-Kermit command-line arguments.
>
>: Any help would be greatly appreciated.
>:
>The trick that you are looking for is documented, somewhat obscurely,
>on pages 353, 383, 469, and 513 of "Using C-Kermit", 2nd edition:
>
> 1. If you put an "=" sign (surrounded by whitespace) on the command line,
> the following words are ignored, but still assigned to the argument
> vector array, \&@[].
>
> 2. You can use a FOR loop to loop through the argument vector array
> elements until you find the one whose value is "=".
>
> 3. The ones after that are your variables.
>
>Example:
>
> $kermit maillogs = 10.2.2.14 joebloe joepasswd maillog
>
>(note insertion of "=" sign)
>
>The maillogs script can retrieve the arguments as follows:
>
> local \%i \%k
> for \%i 0 \v(args)-1 1 {
> xif equal "\&@[\%k]" "=" {
> assign \%k \%i
> increment \%k
> break
> }
> }
>
>At this point, if \%k is defined, it is the index of your first variable:
>
> \&@[\%k] is 10.2.2.14
> \&@[\%k+1] is joebloe
> \&@[\%k+2] is joepasswd
> \&@[\%k+3] is joepasswd
> \&@[\%k+4] is maillog
>
>Granted, this is obscure, nonintuitive, and cryptic. The next version
>of C-Kermit will include a much better way to access these variables:
>within the script, you will be able to refer to these variables like this:
>
> \%0 = the name of the script file (maillogs)
> \%1 = the first argument after "=" (10.2.2.14)
> \%2 = the second argument after "=" (joeblow)
>
>and so on. (This feature is not in C-Kermit 6.1 Beta.05; it will be in
>7.0 Alpha.01 and in the next release of K-95 -- watch this space for
>announcements.)
>
>By the way, the reason for the "=" is to allow a mixture of arguments to
>Kermit and arguments to the script on the same command line. Thus, both
>examples above would work just as well if your command line was:
>
> $kermit maillogs -i -Q -Y -H = 10.2.2.14 joebloe joepasswd maillog
>
>And finally, note that you can remove the word "kermit" from the command
line
>if you first:
>
> chmod +x maillogs
>
>and put:
>
> #!/usr/local/bin/kermit
>
>as the first line (substitute the actual pathname of the Kermit
executable).
>
>Now you can just run the script as if it were a shell script (except that
>you still need the "=" to precede the argument list):
>
> $maillogs = 10.2.2.14 joebloe joepasswd maillog
>
>See p.513 for details.
>
>- Frank